//
//  UIBarButtonItem+Extensions.swift
//  RKWeibo
//
//  Created by Rick on 2017/3/3.
//  Copyright © 2017年 Ricky. All rights reserved.
//

import Foundation


extension UIBarButtonItem{
    
    convenience init(title:String,fontSize:CGFloat=16,target:AnyObject?,action:Selector,isBackArrow:Bool=false) {
        let btn:UIButton = UIButton.cz_textButton(title, fontSize: fontSize, normalColor: UIColor.darkGray, highlightedColor: UIColor.orange)
        if isBackArrow{
          let imageName = "navigationbar_back_withtext"
          btn.setImage(UIImage.init(named: imageName), for: .normal)
          btn.setImage(UIImage.init(named: imageName+"_highlighted"), for: .highlighted)
          btn.sizeToFit()
        }
        btn.addTarget(target, action: action, for: .touchUpInside)
        self.init(customView:btn)
    }
}
